package com.shiliao.app.dialog;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.shiliao.app.R;
import com.yimei.framework.ui.dilaog.AnimationType;
import com.yimei.framework.ui.dilaog.YimeiBaseDialog;


/**
 * Created by huihuili on 2017/7/17.
 */

public class MyPicDialog extends YimeiBaseDialog {

    private TextView mPaiPic;
    private TextView mCameraPic;
    private TextView mCancle;

    /**
     * 构造函数.
     *
     * @param activity context
     */
    public MyPicDialog(Activity activity) {
        super(activity);
        if (activity != null && mDialog != null) {
            mActivity = activity;
            if (null == getLayoutInflater()) {
                return;
            }
            mContainerView = getLayoutInflater().inflate(
                    R.layout.dialog_my_pic, null);
            mDialog.setCanceledOnTouchOutside(false);
            mPaiPic = (TextView) mContainerView.findViewById(R.id.push_pic);
            mCameraPic = (TextView) mContainerView.findViewById(R.id.carme_pic);
            mCancle = (TextView) mContainerView.findViewById(R.id.cancle);
            mWindow.setWindowAnimations(mAnimations[AnimationType.TOAST_FADE
                    .getValue()]);
        }

    }

    @Override
    public void show(boolean isAutoDismiss) {
        super.show(isAutoDismiss);
        WindowManager.LayoutParams layoutParams = mDialog.getWindow().getAttributes();
        layoutParams.gravity = Gravity.BOTTOM;
        mDialog.getWindow().setAttributes(layoutParams);
    }

    public void setPaiPic(View.OnClickListener listen) {
        if (mPaiPic != null) {
            mPaiPic.setOnClickListener(listen);
        }
    }

    public void setCamera(View.OnClickListener listen) {
        if (mCameraPic != null) {
            mCameraPic.setOnClickListener(listen);
        }
    }

    public void setCancle(View.OnClickListener listen) {
        if (mCancle != null) {
            mCancle.setOnClickListener(listen);
        }
    }
}
